package com.itheima.reggie.Controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.reggie.common.BaseContext;
import com.itheima.reggie.common.R;
import com.itheima.reggie.entity.AddressBook;
import com.itheima.reggie.service.AddressBookService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/addressBook")
@RestController
@Slf4j
public class AddressBookController {
    @Autowired
    AddressBookService addressBookService;
@PostMapping
    public R<AddressBook> save(@RequestBody AddressBook addressBook){
    addressBook.setUserId(BaseContext.getCurrentId());
    addressBookService.save(addressBook);
    return R.success(addressBook);



    }
}